* Source: data_acute_illness_patients_mixedlogit_vs4.dta
* Action: Table 1: descriptive statistics by provider 
* Output: ---

use "data_acute_illness_patients_mixedlogit_vs4.dta", clear

* A. Patient characteristics
* The statistics are calculated among the groups of patients actually attending a specific type of provider (d_==1)

bysort typeprov: sum female age age_diff no_child hhsize  schooling if d_==1   /* data on chosen provider */

* schooling by gender
table typeprov female if d_==1, c(mean schooling) row

* aggregate consumption
table typeprov if d_==1, c(mean aggregcon med aggregcon) row

* religion 
tab q01_16 if d_==1
tab typeprov q01_16 if d_==1, row

* ethinicity
tab ethnic if d_==1
tab typeprov ethnic if d_==1, row

* provider choice by gender
table typeprov female if d_==1, c(count d_) row col

* frequencies of illness typology by provider
table typeprov typeill if d_==1, c(count d_) row col


* B. Provider characteristics

gen price_in_naira = p_*1000

* price imputed 
sum price_in_naira   if  typeprov==1, det 
sum price_in_naira   if  typeprov==2, det 
sum price_in_naira   if  typeprov==3, det 
sum price_in_naira   if  typeprov==4, det 

* quality indicators
preserve
unique no_facility
egen get_sample_provider = tag(no_facility)
keep if get_sample_provider
table typeprov, c(mean doctor_tot) row
table typeprov, c(mean beds) row
tab typeprov generator2009, row
restore
tab typeprov generator2009 if d_==1, row
